﻿using System.Threading.Tasks;
using Magicodes.ExporterAndImporter.Excel.AspNetCore;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using NP.BPMReportPlatform.YJJSZHSQ.Dtos;
using Volo.Abp.Application.Dtos;

namespace NP.BPMReportPlatform.YJJSZHSQ
{
    /// <summary>
    /// 月结解锁账户申请
    /// </summary>
    [Authorize]
    [ApiController]
    [Route("api/YJJSZHSQ")]
    public class YJJSZHSQController : BPMReportPlatformController
    {
        private readonly IYJJSZHSQService _yJJSZHSQService;

        public YJJSZHSQController(IYJJSZHSQService yJJSZHSQService)
        {
            _yJJSZHSQService = yJJSZHSQService;
        }

        /// <summary>
        ///月结解锁账户申请 查询数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("YJJSZHSQ/GetAllAsync")]
        public async Task<PagedResultDto<GetYJJSZHSQOutput>> GetAllAsync([FromBody] GetYJJSZHSQInput input)
        {
            return await _yJJSZHSQService.GetAllAsync(input);
        }

        /// <summary>
        /// 月结解锁账户申请 导出数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("YJJSZHSQ/ExportAsync")]
        public async Task<XlsxFileResult<GetYJJSZHSQOutput>> ExportAsync([FromBody] GetYJJSZHSQInput input)
        {
            var rst = await _yJJSZHSQService.ExportAsync(input);
            return new XlsxFileResult<GetYJJSZHSQOutput>(rst, "导出Excel");
        }
    }
}